package com.varian.redis.aspect;

import jakarta.annotation.Nonnull;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.aspectj.lang.annotation.Aspect;

import java.util.Objects;

/**
 * @author ben
 * @since 2024/9/26
 */
@Aspect
public class VarianCacheAspect extends VarianCacheAspectSupper implements MethodInterceptor {

    @Override
    public Object invoke(@Nonnull MethodInvocation invocation) throws Throwable {
        VarianCacheInterceptor cacheInterceptor = invocation::proceed;
        return execute(cacheInterceptor, Objects.requireNonNull(invocation.getThis()), invocation.getMethod(), invocation.getArguments());
    }

}
